package com.lujianfei.powerinput.widget.input.factory;

import android.content.Context;
import android.util.Log;

import com.lujianfei.powerinput.widget.input.base.IWidgetInput;

import java.lang.reflect.Constructor;

public class InputFactory {
    private static final String TAG = "InputFactory";
    public static IWidgetInput newInput(String className,Context context){
        try{
            Class<?> aClass = Class.forName(className);
            Constructor constructor = aClass.getConstructor(new Class[]{Context.class});
            return (IWidgetInput) constructor.newInstance(context);
        }catch (Exception e){
            Log.e(TAG,""+e);
        }
        return null;
    }
}
